package com.lenin.metro.shared;

import java.io.Serializable;

public class MapObject implements Serializable {

	private String key;

	private Tile[][] tiles;
	private int latLength;
	private int lngLength;
	private int tileSize;

	private String imageCss;

	private MapCoordinates coordinates;

	public MapObject() {

	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public Tile[][] getTiles() {
		return tiles;
	}

	public void setTiles(Tile[][] tiles) {
		this.tiles = tiles;
	}

	public int getLatLength() {
		return latLength;
	}

	public void setLatLength(int latLength) {
		this.latLength = latLength;
	}

	public int getLngLength() {
		return lngLength;
	}

	public void setLngLength(int lngLength) {
		this.lngLength = lngLength;
	}

	public int getTileSize() {
		return tileSize;
	}

	public void setTileSize(int tileSize) {
		this.tileSize = tileSize;
	}

	public String getImageCss() {
		return imageCss;
	}

	public void setImageCss(String imageCss) {
		this.imageCss = imageCss;
	}

	public MapCoordinates getCoordinates() {
		return coordinates;
	}

	public void setCoordinates(MapCoordinates coordinates) {
		this.coordinates = coordinates;
	}

	public ProjectionPoint getRectBottomRight() {

		MapCoordinates hMin = new MapCoordinates(getLatLength(), 0);
		MapCoordinates vMax = new MapCoordinates(0, getLngLength());

		ProjectionPoint hMinPoint = MapCoordinates.coordsToPoint(hMin);
		ProjectionPoint vMaxPoint = MapCoordinates.coordsToPoint(vMax);

		long width = vMaxPoint.getX() - hMinPoint.getX();
		long height = Math.max(hMinPoint.getY(), vMaxPoint.getY())
				+ (getTileSize() / 2);
		
		return new ProjectionPoint(width, height);

	}

}
